package utils;

public class Point {

	private float x = 0, y = 0;

	public Point(float x, float y) {
		this.x = x;
		this.y = y;
	}

	public Point(float abs, double angle) {
		this.x = (float) (abs * Math.cos(angle));
		this.y = (float) (abs * Math.sin(angle));
	}

	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}

	public Point set(float x, float y) {
		return new Point(x, y);
	}

	public Point set(Point newPos) {
		return set(newPos.getX(), newPos.getY());
	}

	public Point add(float dX, float dY) {
		return new Point(getX() + dX, getY() + dY);
	}

	public Point add(Point dPos) {
		return add(dPos.getX(), dPos.getY());
	}

	public Point negate() {
		return set(-getX(), -getY());
	}

	public Point subtract(Point p) {
		return add(p.negate());
	}

	public Point multiply(float n) {
		return multiply(new Point(n, n));
	}

	public Point multiply(Point p) {
		return new Point(getX() * p.getX(), getY() * p.getY());
	}

	@Override
	public String toString() {
		return "(" + x + ", " + y + ")";
	}

}
